# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=fuzzap
pkgver=17.057002b
pkgrel=5
groups=('blackarch' 'blackarch-wireless')
pkgdesc='A python script for obfuscating wireless networks.'
arch=('any')
url='https://github.com/lostincynicism/FuzzAP'
license=('custom')
depends=('python2' 'python2-scapy')
makedepends=('git')
source=("$pkgname::git+https://github.com/lostincynicism/FuzzAP.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i 's|python$|python2|' *.py
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 755 "$pkgname.py" "$pkgdir/usr/share/$pkgname/$pkgname.py"
  install -Dm 644 -t "$pkgdir/usr/share/$pkgname/" common.txt ssid.txt
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

